import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from 'path';
import styleImport from "vite-plugin-style-import";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    styleImport({
      libs: [
        {
          libraryName: "vant",
          esModule: true,
          resolveStyle: (name) => `vant/es/${name}/style`,
        },
      ],
    }),
  ],
  base:"./",//打包路径
  resolve: {
    alias:{
      '@': path.resolve(__dirname, './src')//设置别名
    }
  },
  server: {
    port:4000,//启动端口
    open: true,
    proxy: {
      // 选项写法
      '/api': 'http://123.56.85.24:5000',//代理网址
      '/online': {
        target: 'http://dev-oms-backend.crec.cn/oms',
        ws: true,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/online/, '')
      },
      '/verification': {
        target: 'http://10.81.106.123/idp',

        ws: true,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/verification/, '')
      },
    },
    cors:true
  }

})
